import * as types from "../mutation-types";
const state = {
  effect: {
    translate3d: true
  },
  user: {
    isLoggedIn: false,
    info: {}
  }
};

const mutations = {
  [types.SWITCH_EFFECT](state, effectItem) {
    for (let name in effectItem) {
      state.effect[name] = effectItem[name];
    }
  },
  [types.LOGGINGIN](state) {
    state.user.isLoggedIn = false;
  },
  [types.LOGGEDIN](state) {
    state.user.isLoggedIn = true;
  },
  [types.LOGGINGIN](state) {
    state.user.isLoggedIn = false;
  },
  [types.SET_USER](state, payload) {
    state.user.info = payload;
  },
  [types.OPERATION_USER](state) {
    return state.user.info.role.id;
  }
};

export default {
  state,
  mutations
};
